<%@ page language="java" import="java.util.*,entity.*,dao.*,dao.impl.*" pageEncoding="UTF-8"%>
<%
  request.setCharacterEncoding("utf-8");
  String title = request.getParameter("title");
  String content = request.getParameter("content");
  ReplyDao replyDao= new ReplyDaoImpl();
  User user =(User)session.getAttribute("user");
  int boardId = Integer.parseInt(request.getParameter("boardId"));
  int topicId = Integer.parseInt(request.getParameter("topicId"));
  
  if(user!=null){
  Reply reply = new Reply();
  reply.setTitle(title);
  reply.setContent(content);
  reply.setTopicId(topicId);
  reply.setUserId(user.getUserId());
  
  replyDao.addReply(reply);
  response.sendRedirect("../detail.jsp?page=1&boardId="+boardId+"&topicId="+topicId);
  return;
  }
  else{
  	response.sendRedirect("../login.jsp");
  }
%>